package com.chen.controller;

import cn.hutool.core.util.StrUtil;
import com.alipay.easysdk.factory.Factory;
import com.chen.dto.UserRechargeDto;
import com.chen.entity.UserRechargeOrders;
import com.chen.service.UserPayService;
import com.chen.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

/**
 * @author cws
 * @since 2022-08-06
 * 用户支付接口
 */
@RestController
@RequestMapping("/user/pay")
@Slf4j
public class UserPayController {

    @Resource
    private UserPayService userPayService;

    @ApiModelProperty("充值进入支付界面")
    @PostMapping("/recharge")
    public Result recharge(@RequestBody UserRechargeDto userRechargeDto,
                         @RequestHeader("Authorization") String token,
                         HttpServletResponse httpResponse
    ) {
          return  userPayService.recharge(userRechargeDto.getAmount(), userRechargeDto.getOrderId(),httpResponse,token);
    }



}

